
const mapping = {};

export default {
    subscribe(topic, callback) {
        mapping[topic] = callback;
    },
    unsubscribe(topic) {
        mapping[topic] = null;
    },
    publish(topic, message) {
        const func = mapping[topic];
        func(message);
    }
}